//
//  LZRegionSelectView.m
//  laziz_Consumer
//
//  Created by XMac on 16/10/25.
//  Copyright © 2016年 XBN. All rights reserved.
//

#import "LZRegionSelectView.h"

@interface LZRegionSelectView ()

@property(nonatomic , strong) UILabel *regionLabel;

@property(nonatomic , strong) CAGradientLayer *gradientLayer;

@end
@implementation LZRegionSelectView




- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setBackgroundColor:[UIColor clearColor]];
        
        [self configUI:frame];
    }
    return self;
}


-(void)configUI:(CGRect)frame{
    
    _regionLabel = ({
    
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 55, 40)];
        
        label.lineBreakMode = NSLineBreakByTruncatingTail;
        
        label.textColor = UIColorFromRGB(0x666666, 1);
        
        label.font = [UIFont fontWithName:@"STHeitiSC-Light" size:17];
        
        label;
    });
    
    UIImageView *imageView = ({
    
        UIImageView *iv = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"comment_av_view_down"]];
        iv.frame = CGRectMake(56, 17, 12, 6);
        iv;
    });
    
    
    [self addSubview:_regionLabel];
    _regionLabel.layer.zPosition = 10;
    [self addSubview:imageView];
}

-(void)changeTitle:(NSString *)title{
    self.regionLabel.text = title;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    
    DLog(@"LZRegionSelectView  加载了");
    /*
    if (_gradientLayer) {
        [_gradientLayer removeFromSuperlayer];
        _gradientLayer = nil;
    }
    
    _gradientLayer = [CAGradientLayer layer];
    
    _gradientLayer.frame = self.bounds;
    
    _gradientLayer.colors = @[(__bridge id)[UIColor blackColor].CGColor,(__bridge id)[UIColor whiteColor].CGColor];
    
    _gradientLayer.startPoint = CGPointMake(0, 0.5);
    
    _gradientLayer.endPoint = CGPointMake(1, 0.5);
    
    _gradientLayer.zPosition = 100;
    
    [self.layer addSublayer:_gradientLayer];
    
    _gradientLayer.mask = _regionLabel.layer;
     */
}

@end
